package com.example.gesture.Clicked

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.material.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun CombinedClickableDemo() {
    var enabled by remember {
        mutableStateOf<Boolean>(true)
    }

    var color by remember {
        mutableStateOf(Color.Green)
    }

    Box(
        modifier = Modifier
            .size(200.dp)
            .combinedClickable(
                enabled = enabled,
                onClick = { color = Color.Blue },
                onLongClick = { color = Color.Yellow },
                onDoubleClick = { color = Color.Red }
            )
            .background(color = color),
        contentAlignment = Alignment.Center
    ) {
        Text(text = "Hello Jetpack")
    }
}